package com.fordmotor.exception;


public class RuntimeErrorCodeException extends RuntimeException {

    private RuntimeError runtimeError;

    public RuntimeErrorCodeException(RuntimeError runtimeError) {
        this.setRuntimeError(runtimeError);
    }

    public RuntimeErrorCodeException(){}

    public RuntimeErrorCodeException(String msg) {
        runtimeError.setMsg(msg);
    }

    public RuntimeErrorCodeException(String code , String msg) {
        RuntimeErrorCodeException runtimeErrorCodeException = new RuntimeErrorCodeException();
       // RuntimeError.valueOf()
        //RuntimeError error =new RuntimeError(code,msg);
        //error.setMsg();
        //errorMessage.setMsg(msg);
       // errorMessage.setCode(code);
        setRuntimeError(runtimeError);
    }

    public RuntimeError getRuntimeError() {
        return runtimeError;
    }

    public void setRuntimeError(RuntimeError runtimeError) {
        this.runtimeError = runtimeError;
    }

    @Override
    public String getMessage() {
        String message = runtimeError.getCode() + ":" + runtimeError.getMsg() + "\n\r";
        return message + super.getMessage();
    }


}
